<?php

class Model_Form_LostPassword extends Model_Form
{
    public function init()
    {
        parent::init();

        $this
            ->setAction('/user/lost-password/send-instructions')
            ->setMethod('post')
            ->setDescription('Please provide the email used to create your account')
            ->setAttrib('id', 'lost-password-form');

        $this->addElements(array(
            $this->getEmail(),
            $this->getSubmitButton()
        ));
    }

    protected function getEmail()
    {
        $user = new Model_User();
        $el = parent::getEmail();
        $el
            ->removeValidator('DbUnique')
            ->addValidator('DbRowExists', true, array($user, 'email'));
        return $el;
    }
}
